#pragma once
#include <string>
#include <Windows.h>
#include <sys/stat.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <direct.h>
#include <map>
#include "StringUtil.h"
#ifdef USE_MD5_DLL

#else
#include <md5/md5.h>
#endif

class FileUtil
{
public:
	FileUtil(void);
	~FileUtil(void);
	static HANDLE CreateFile(std::string strFile,long  lFileSize = 0);	
	static bool CreateDir(std::string strPath);
	static std::string GetParentDir(std::string strPath);
	static HANDLE OpenFile(std::string strPath);
	static bool IsFile(std::string strPath);
	static bool IsDir(std::string strPath);
	static bool IsExist(std::string strPath);
	static bool WriteFile(HANDLE hFile,char* pBuffer,int lBufferSize);
	static bool Close(HANDLE hFile);
	static std::string GetTmpDir();
	static std::string GetProgramFiles();
	static std::string GetUniqueFileInDir(std::string strDir);
	static std::string GetUniqueFile(std::string strFile);
	static std::string UnifyPath(std::string strPath);
	static std::string GetMd5(std::string strFilePath);
	static bool WriteStr(std::string strFile,std::string strContent);
	static std::string GetCurrentPath();
	static bool Equal(std::string strPath1,std::string strPath2);
	static std::string GetLongPath(std::string strPath1);
	static std::string ReadFile(std::string strFilePath);
	static long GetFileSize(std::string strPath);
	static bool Delete(std::string strPath);
	static void GetSubFileAndDir(std::string strPath,std::list<std::string>& listSubFilesAndDir_out);
	static std::string GetExt(std::string strFilePath);
	static std::string GetDirOrFileName(std::string strFilePath);
	static bool GetAllProcess(std::map<int,std::string>& mapAllProcess_out);
	static bool KillProcess(int iPid);
	static bool ShellExcetue(std::string strExePath,std::string strParam="",int ShowType=SW_SHOWNORMAL);
};
